﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ASPNETDBTableAdapters;
using System.IO;

public partial class Administration_navigation_delete : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        int id = int.Parse(Request.QueryString["id"]);
        FilesTableAdapter adapter = new FilesTableAdapter();
        ASPNETDB.FilesDataTable files = adapter.GetFileByID(id);
        String path = files[0]["filePath"].ToString();

        adapter.DeleteFile(id);
        File.Delete(path);

        Response.Redirect("index.aspx", true);
    }
}